package cn.sq.musicserver.playlist.service.impl;

import cn.sq.musicserver.config.StatusCode;
import cn.sq.musicserver.music.entity.SqMusic;
import cn.sq.musicserver.playlist.entity.SqMuiscPlay;
import cn.sq.musicserver.playlist.entity.SqPlay;
import cn.sq.musicserver.playlist.mapper.SqPlayMapper;
import cn.sq.musicserver.playlist.service.ISqPlayService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 歌曲播放列表 服务实现类
 * </p>
 *
 * @author SQ
 * @since 2020-12-28
 */
@Service
public class SqPlayServiceImpl extends ServiceImpl<SqPlayMapper, SqPlay> implements ISqPlayService {
    @Autowired
    SqMuiscPlayServiceImpl muiscPlayService;

    @Override
    public List<SqMusic> MuiscByPlayid(IPage<SqMusic> page,String playUUID) {
        return super.baseMapper.MuiscByPlayid(page,playUUID);
    }

    @Override
    public Boolean addMusicToPlayList(String playUUID, String MusicUUID) {
        SqMuiscPlay one = muiscPlayService.getOne(new QueryWrapper<SqMuiscPlay>().eq("musicUuid", MusicUUID).eq("playUUid", playUUID));
        if (one!=null){
            return false;
        }
        return true;
    }
}
